/********************************************************
    Copyright (C), 2020-2099,SZ-STREAMING Tech. Co., Ltd.
    File name: V2xLog.h
    Author: xuzhibin 
    Date: 2020-06-12
    Description: V2X log head file
********************************************************/
#ifndef __V2XLOG_H__
#define __V2XLOG_H__

#include <stdio.h>
#include <sys/types.h>
#include "asn_system.h"

static void V2X_LOG_Format(uint32_t level, const char *file, const char *func, uint32_t line, const char *fmt, ...)
{
    char buffer[256];
    
    va_list args;
    va_start(args, fmt);
    vsprintf(buffer, fmt, args);
    printf("[%s,%s:%d]%s", file, func, line, buffer);
    va_end(args);
}

#define V2X_FUNC_BEGIN  printf("[%s][%d] begin\n", __FUNCTION__, __LINE__)
#define V2X_FUNC_END    printf("[%s][%d] end\n", __FUNCTION__, __LINE__)

#define V2X_LOG_MSG_ERROR(fmt...)   V2X_LOG_Format(0, __FILE__, __FUNCTION__, __LINE__, fmt)

#define V2X_LOG_ERROR(fmt...)   V2X_LOG_Format(0, __FILE__, __FUNCTION__, __LINE__, fmt)

typedef enum {
    E_V2X_RET_FAIL = -1,
    E_V2X_RET_SUCC = 0,
    E_V2X_RET_BUTT
}e_V2xRetCode;

#endif
